package com.eastfair.certificate.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.eastfair.database.mybatis.typehandler.M9EncryptHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.certificate.enumeration.BlacklistKindEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author ligang
 * @since 2023-03-02
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
//@TableName(value ="cert_blacklist")
@TableName(value ="cert_blacklist", autoResultMap = true)
@ApiModel(value = "Blacklist", description = "")
@AllArgsConstructor
public class Blacklist extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 展会id
     */
    @ApiModelProperty(value = "展会id")
    @TableField(value = "exhibition_id")
    @Excel(name = "展会id")
    private Long exhibitionId;

    /**
     * 展会名称
     */
    @ApiModelProperty(value = "展会名称")
    @Size(max = 255, message = "展会名称长度不能超过255")
    @TableField(value = "exhibition_name", condition = LIKE)
    @Excel(name = "展会名称")
    private String exhibitionName;

    /**
     * 名称
     */
    @ApiModelProperty(value = "名称")
    @Size(max = 255, message = "名称长度不能超过255")
    @TableField(value = "user_name", condition = LIKE)
    @Excel(name = "名称")
    private String userName;

    /**
     * 身份证号码
     */
    @ApiModelProperty(value = "身份证号码")
    @Size(max = 255, message = "身份证号码长度不能超过255")
    @TableField(value = "card_number", typeHandler = M9EncryptHandler.class)
    @Excel(name = "身份证号码")
    private String cardNumber;

    /**
     * 手机号
     */
    @ApiModelProperty(value = "手机号")
    @Size(max = 255, message = "手机号长度不能超过255")
    @TableField(value = "phone_number", typeHandler = M9EncryptHandler.class)
    @Excel(name = "手机号")
    private String phoneNumber;

    /**
     * 公司名称
     */
    @ApiModelProperty(value = "公司名称")
    @Size(max = 255, message = "公司名称长度不能超过255")
    @TableField(value = "company_name", condition = LIKE)
    @Excel(name = "公司名称")
    private String companyName;

    /**
     * 公司id
     */
    @ApiModelProperty(value = "公司id")
    @TableField(value = "company_id")
    @Excel(name = "公司id")
    private Long companyId;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @Size(max = 255, message = "备注长度不能超过255")
    @TableField(value = "remark", condition = LIKE)
    @Excel(name = "备注")
    private String remark;

    /**
     * 分类:#{POLICE:公安;VENUE:场馆;EXHIBITION:展会;}
     */
    @ApiModelProperty(value = "分类:#{POLICE:公安;VENUE:场馆;EXHIBITION:展会;}")
    @TableField(value = "kind")
    @Excel(name = "分类:#{POLICE:公安;VENUE:场馆;EXHIBITION:展会;}", replace = {"公安_POLICE", "场馆_VENUE", "展会_EXHIBITION",  "_null"})
    private BlacklistKindEnum kind;

    /**
     * 数据来源
     */
    @ApiModelProperty(value = "数据来源")
    @Size(max = 255, message = "数据来源长度不能超过255")
    @TableField(value = "data_resource", condition = LIKE)
    @Excel(name = "数据来源")
    private String dataResource;


    @Builder
    public Blacklist(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer isEnabled, Integer isDeleted, Long tenantId, Long projectId, Long subsystemId, 
                    Long exhibitionId, String exhibitionName, String userName, String cardNumber, String phoneNumber, String companyName, 
                    Long companyId, String remark, BlacklistKindEnum kind, String dataResource) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.tenantId = tenantId;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.exhibitionId = exhibitionId;
        this.exhibitionName = exhibitionName;
        this.userName = userName;
        this.cardNumber = cardNumber;
        this.phoneNumber = phoneNumber;
        this.companyName = companyName;
        this.companyId = companyId;
        this.remark = remark;
        this.kind = kind;
        this.dataResource = dataResource;
    }

}
